package com.ctrip.ec.biz.dao.topic;
import com.ctrip.ec.dal.DaoBase;
import com.ctrip.ec.biz.entity.topic.TopicContentEntity;
import com.ctrip.ec.dal.DbAccess;
import org.springframework.stereotype.Service;

import java.sql.SQLException;
import java.util.List;

@Service
public class TopicContentDao extends DaoBase<TopicContentEntity> {
    public TopicContentDao() {
        super(TopicContentEntity.class);
    }
    public TopicContentDao(DbAccess db) {
        super(TopicContentEntity.class,db);
    }

    public List<TopicContentEntity> listByTopicId(Long topicId) throws SQLException {
        String sql = "select * from " + this.getTableName() + " where topic_id=?";
        List<TopicContentEntity> list = this.db.query(TopicContentEntity.class,sql,topicId);
        return list;
    }
}
